/**
 * @constructor
 */
function CellSpritesCreator(canvas,canvasWidth, canvasHeight, updateTimeMs, menuManager, debugConsole) {
	
	this.canvas = canvas;
	this.canvasWidth = canvasWidth;
	this.canvasHeight = canvasHeight;
	this.updateTimeMs = updateTimeMs;
	this.menuManager = menuManager;
	this.debugConsole = debugConsole;

	/**
	 * @public
	 * 
	 * @param areaWidth
	 * @param areaHeight
	 * @param cellSize
	 * 
	 * @return{CellSpritesContext} CellSpritesContext
	 */
	this.create = function(cellSize) {		
		areaWidth = this.canvasWidth;
		areaHeight = this.canvasHeight;
		
		cellSprites = new Array();
		
		cellColumns = areaWidth/cellSize;
		cellRows = areaHeight/cellSize;
		
		cellSpritesContext = new CellSpritesContext(cellSprites, cellColumns, cellRows, this.debugConsole);
		
		for(y=0; y<cellColumns; y++) {
			for(x=0; x<cellRows; x++) {
				cellSprite = new CellSprite(this.canvas, this.updateTimeMs, cellSize, TerrainType.PASSABLE, this.menuManager, this.debugConsole);
				
				cellX = x*cellSize + cellSize/2;
				cellY = y*cellSize + cellSize/2;
				
				cellSprite.moveCenterAt(cellX, cellY);
				cellSprite.setCellSpritesContext(cellSpritesContext);
				
				cellSprites.push(cellSprite);
			}
		}
		return cellSpritesContext;
	};
}